package com.easy.frame.servers.sys.service.impl.project;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.easy.frame.base.api.pojo.PageDTO;
import com.easy.frame.base.api.pojo.PageVO;
import com.easy.frame.base.basic.ServiceResponse;
import com.easy.frame.base.basic.enums.ResponseCodeEnum;
import com.easy.frame.base.service.mp.page.PageProxy;
import com.easy.frame.servers.sys.dto.SysProjectDetailPageDTO;
import com.easy.frame.servers.sys.entity.SysProjectDetail;
import com.easy.frame.servers.sys.mapper.project.SysProjectDetailMapper;
import com.easy.frame.servers.sys.service.project.SysProjectDetailService;
import com.easy.frame.servers.sys.vo.SysProjectDetailPageVO;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 项目详情表 服务实现类
 *
 * @author zzf
 * @since 2020-12-14
 */
@Service
public class SysProjectDetailServiceImpl extends ServiceImpl<SysProjectDetailMapper, SysProjectDetail> implements SysProjectDetailService {

    @Override
    public PageVO<SysProjectDetailPageVO> selectForPage(PageDTO<SysProjectDetailPageDTO> pageDTO) {
        PageVO<SysProjectDetailPageVO> proxy = PageProxy.proxy(baseMapper::selectForPage, pageDTO);
        List<SysProjectDetailPageVO> records = proxy.getRecords();
        ServiceResponse<List<SysProjectDetailPageVO>> success = new ServiceResponse<>(records, ResponseCodeEnum.SUCCESS);
        proxy.setRecords(success.getData());
        return proxy;
    }

    @Override
    public SysProjectDetail selectById(Long id) {
        return baseMapper.selectById(id);
    }
}
